﻿using Magicodes.ExporterAndImporter.Excel;
using Magicodes.ExporterAndImporter.Pdf;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Account;
using Volo.Abp.AutoMapper;
using Volo.Abp.BlobStoring;
using Volo.Abp.BlobStoring.FileSystem;
using Volo.Abp.BlobStoring.Minio;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.TenantManagement;

namespace Coway.Ordering
{
    [DependsOn(
        typeof(OrderingDomainModule),
        typeof(AbpAccountApplicationModule),
        typeof(OrderingApplicationContractsModule),
        typeof(AbpIdentityApplicationModule),
        typeof(AbpPermissionManagementApplicationModule),
        typeof(AbpTenantManagementApplicationModule),
        typeof(AbpFeatureManagementApplicationModule)
        )]
    [DependsOn(typeof(AbpBlobStoringMinioModule))]
    [DependsOn(typeof(AbpBlobStoringFileSystemModule))]
    public class OrderingApplicationModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            Configure<AbpAutoMapperOptions>(options =>
            {
                options.AddMaps<OrderingApplicationModule>();
            });

            Configure<AbpBlobStoringOptions>(options =>
            {
                options.Containers.ConfigureDefault(container =>
                {
                    container.UseFileSystem(f =>
                    {
                        f.BasePath = @"C:\WebCode\Coway.Ordering\wwwroot\PDF";
                    });
                });
            });

            //添加导入导出组件的注入关系
            context.Services.AddSingleton<IExcelExporter, ExcelExporter>();
            context.Services.AddSingleton<IExcelImporter, ExcelImporter>();
            context.Services.AddSingleton<IPdfExporter, PdfExporter>();
        }
    }
}
